import { createRouter, createWebHistory, createWebHashHistory } from 'vue-router'
import Test from '@/views/test/index.vue'
// 路由配置数组
const routes = [
  {
    path: '/test',
    component: Test,
    name:'测试',
    mete:{
      title:'测试'
    }
  },
  {
    path:'/',
    redirect:'/layout',
  },
  {
    path:'/layout',
    component:() => import('@/views/layout/index.vue'),
    redirect:'/home',
    children:[
      // 首页
      {
        path:'/home',
        name:'首页',
        component:() => import('@/views/home/index.vue'),
        mete:{
          title:'首页'
        }
        
      },
      {
        path:'/dataService',
        name:'数据服务',
        redirect:'/dataQuery',
        component:() => import('@/views/dataService/index.vue'),
        children:[
          // 数据查询
          {
            path:'/dataQuery',
            name:'数据查询',
            component:() => import('@/views/dataService/dataQuery.vue'),
            mete:{
              title:'数据查询'
            }
          },
          // 文件管理
          {
            path:'/fileManage',
            name:'文件管理',
            component:() => import('@/views/dataService/fileManage.vue'),
            mete:{
              title:'文件管理'
            }
          },
          // // 定期清理设置
          {
            path:'/clearSetting',
            name:'定期清理设置',
            component:() => import('@/views/dataService/clearSetting.vue'),
            mete:{
              title:'测试'
            }
          },
          // 数据操作说明
          {
            path:'/operateInfo',
            name:'数据操作说明',
            component:() => import('@/views/dataService/operateInfo.vue'),
            mete:{
              title:'数据操作说明'
            }
          },
        ]
      },
      {
        path:'/bussService',
        name:'业务服务',
        component:() => import('@/views/bussService/index.vue'),
        mete:{
          title:'业务服务'
        }
      },
      {
        path:'/monitorAlarm',
        name:'监控告警',
        component:() => import('@/views/monitorAlarm/index.vue'),
        mete:{
          title:'监控告警'
        }
      },
      {
        path:'/statisAnalysis',
        name:'统计分析',
        component:() => import('@/views/statisAnalysis/index.vue'),
        mete:{
          title:'统计分析'
        }
      },
      {
        path:'/systemManage',
        name:'系统管理',
        component:() => import('@/views/systemManage/index.vue'),
        mete:{
          title:'系统管理'
        }
      },
    ]
  },
]
// 创建路由实例
const router = createRouter({
  // 一般项目打包后，都部署到root根目录，但是公司可能会把项目部署到root下面某个文件夹里，
  // 例如：部署到 文件夹/consult下面，这时候就需要在vite.config.ts配置一下base的值='/consult'，不然这个网站补不能正常访问
  // history: createWebHistory(import.meta.env.BASE_URL),
  history: createWebHashHistory(),
  routes
})

export default router
